package jc.malpractice.controllers;

import jc.malpractice.service.MastService;
import spark.Route;

import static spark.Spark.get;

public class MastController {


    static Route part_select = (request, response) -> {
        String status = request.raw().getParameter("status");
        String keywords = request.raw().getParameter("keywords");
        String injury_level = request.raw().getParameter("injury_level");
        String handler = request.raw().getParameter("handler");
//        System.out.println(keywords);
//        System.out.println(injury_level);
//        System.out.println(status);
//        System.out.println(handler);
        return MastService.partselect(status,keywords,injury_level,handler);
    };

    static Route Solvents = (request, response) -> {
        return MastService.list();
    };
    static Route check_admin = (request, response) ->{
        String reporter_code = request.raw().getParameter("reporter_code");
        return MastService.check(reporter_code);
    };
    public static void Init() {
        get("/test/all_event",MastController.Solvents);
//        get("/test/find_dept",MastController.find_dept);
        get("/report/partreporevent",MastController.part_select);
        get("/is_admin",MastController.check_admin);
    }
}
